//package com.geely.pma.climate.api.single
package com.wanghaibo.vgashow.api.single

import com.ecarx.xui.adaptapi.car.base.ICarFunction
import io.reactivex.SingleEmitter

/**
 * Name: SetFunctionValue
 *
 * Created by Wuhao on 2020/6/2
 *
 * Version: 0.0.1
 */
class SetFunctionValueTask(
    emitter: SingleEmitter<Boolean>,
    private val function: Int,
    private val zone: Int?,
    private val value: Int
) : SingleOperation<Boolean>(emitter) {

    override fun onInitialized(carFunction: ICarFunction) {
        if (zone == null) {
            emitter.onSuccess(carFunction.setFunctionValue(function, value))
        } else {
            emitter.onSuccess(carFunction.setFunctionValue(function, zone, value))
        }
    }

}